<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>自选股</title>
		<link href="css/text.css" rel="stylesheet" type="text/css" />
		<style type="text/css">							
			.fixedBox{
				border: 1px solid #555555;				
				white-space: nowrap;	
			}
			.fixedBox::-webkit-scrollbar {
				width: 10px;     
				height: 10px;				
			}
			
			table{
				width:240px; 
				border-collapse:collapse; 
				text-align:center;
			}
			td,th{border:1px solid #696969}	
			
			
			input[type="radio"] {
				width: 15px;
				height: 15px;
				
				border: 1px solid #269F44;
			}

			input[type="radio"]:checked {
				-webkit-appearance: none;
				background-color: #fff;
				position: relative;
				border: 1px solid #269F44;
				border-radius: 50%;
				outline: none;
				cursor: pointer;
			}

			input[type="radio"]:checked::after {
				position: absolute;
				content: '';
				left: 50%;
				top: 50%;
				transform: translate(-50%, -50%);
				width: 6px;
				height: 6px;
				border-radius: 50%;
				background-color: #1E90FF;
			}

		</style>
	</head>
	<body>
		<div id="towriter" class="fixedBox" style="display:none;">
			<div id="towrite" class="fixedBox" style="position:relative;">
				<div id="towrite1" class="fixedBox" style="position:relative; float:left;"></div>
				<div id="towrite2" class="fixedBox" style="position:relative; float:left;"></div>
			</div>
		</div>
		<script type="text/javascript" src="js/json2html.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script>
			var bkcolor = $("body").css("backgroundColor")	
			var w = 2; //w = 1 读取“自选股.txt”；w = 2 读取指定板块文件；
			window.onload = function() {							
				changeStyle();
				start(1);
			}
			
			function load(name) {
				var xhr = new XMLHttpRequest()							
				okStatus = document.location.protocol === "file:" ? 0 : 200;				
				xhr.open('GET', name, false);
				xhr.overrideMimeType("text/html;charset=gb2312");//默认为utf-8				
				xhr.send(null);
				return xhr.status === okStatus ? xhr.responseText : null;
			}
			
			function time_range(beginTime, endTime) {
				var strb = beginTime.split(":");
				if (strb.length != 2) {
					return false;
				}

				var stre = endTime.split(":");
				if (stre.length != 2) {
					return false;
				}

				var b = new Date();
				var e = new Date();
				var n = new Date();

				b.setHours(strb[0]);
				b.setMinutes(strb[1]);
				e.setHours(stre[0]);
				e.setMinutes(stre[1]);

				if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {
					if(sx == 1){
						zxg();						
					}else{
						kpl(fx);
						//changeCssbk(objt1,trid1,"bk");
					}
					thclick();
					changeCss1(objt,trid,"gg");					
					console.log(true)　　　　　　
					return true;				
				} else {
					console.log(false)
				    return false;     
				}
			}　　　
   　　　
			$(function() {
				setInterval(function() {
					time_range("9:00","15:15")						
				},
				30000);
			})

			function thclick() {
				if(rn != 100 && (sx == 1 || (sx > 1 && rn != 2))){					
					sfx = 1;
					//var table = document.getElementById('towrite1').getElementsByTagName("table")[0];
					var table = document.getElementById("gg");
					var headers = table.getElementsByTagName("th");
					headers[rn].onclick();
				}				
			}
			
			function changeStyle() {
				var obj = document.getElementById("towriter");
				obj.style.border= "none";
				obj.style.display= "block";
				obj.style.left= "0px"; 				
				obj.style.width= "100%";	
				
				var div = document.getElementById("towrite");	
				//div.style.border= "1px solid #fff";
				div.style.border= "none";
				div.style.marginTop= "-20px";				
				div.style.left= "0px"; 				
				div.style.width= "120%";	//此处调宽度
				div.style.height= "100%";		
				
				var obj1 = document.getElementById("towrite1");	
				//obj1.style.border= "1px solid #fff";				
				obj1.style.left= "0px"; 				
				obj1.style.width= "280px";	
				//obj1.style.height= "98%";		
				obj1.style.fontSize="12px";	
				
				var obj2 = document.getElementById("towrite2");	
				//obj2.style.border= "1px solid #fff";	
				obj2.style.left= "5px"; 				
				obj2.style.width= "73%";	
				//obj2.style.height= "98%";		
				obj2.style.fontSize="12px";		
				
				var div2 = document.createElement("div");
				div2.id = "bar2";
				//div2.style.border= "1px solid #696969";				
				div2.style.width= "90%";
				div2.style.height= "20px";					
				obj2.appendChild(div2);				
					
				for (i = 1; i <= 6; i++){
					var obj = document.createElement("iframe");
					obj.id = "mapIframe" + i;
					//obj.className = "fixedBox";
					//obj.style.border= "none";
					obj.style.border= "1px solid #696969";
					obj.style.position= "relative"; 
					obj.style.float= "left"; 
					obj.style.left= "0px";
					obj.style.marginTop= "-10px";
					obj.style.width= "32%";
					obj.style.height= "47%";					
					obj.style.fontSize="12px";						
					obj2.appendChild(obj);					
				}
			}	
						
			Date.prototype.Format = function (fmt) {
				var o = {
				"M+": this.getMonth() + 1, //月份
				"d+": this.getDate(), //日
				"h+": this.getHours(), //小时
				"m+": this.getMinutes(), //分
				"s+": this.getSeconds(), //秒
				"q+": Math.floor((this.getMonth() + 3) / 3), //季度
				"S": this.getMilliseconds() //毫秒
				};
				if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
				if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
				return fmt;
			};
			
			function keepTwoDecimal(num) {  
               var result = parseFloat(num);  
               if (isNaN(result)) {  
                   //alert('传递参数错误，请检查！');  
                   return false;  
               }  
               result = Math.round(num * 100) / 100;  
               return result;  
			};
			
			$(function () {   //动态追加的元素触发事件
				$("body").delegate("input",
					"change",
					function () {
						//alert(this.id)
						if(this.id == "Radio1"){
							$("#Radio1").prop('checked', true);
							$("#Radio2").prop('checked', false);
							rn = 100;
						}else if(this.id == "Radio2"){
							$("#Radio1").prop('checked', false);
							$("#Radio2").prop('checked', true);
							rn = 100;							
						}
						//dms = "";
						zxg();
					});
			});
			
			var sx = 1;
			function start(p) {
				sx = p
				var div = document.getElementById('towrite1');
				var a1 = "<a style='padding-left:5px;font-size:14px;' href='javascript:void(0)' id='a1' onclick='start(1)'>" + "自选股" + "</a>";	
				var a2 = "<a style='padding-left:10px;font-size:14px;' href='javascript:void(0)' id='a2' onclick='start(2)'>" + "KPL" + "</a>";						
				var bar = '<div id="bar" style="width:90%;height:20px;">' + a1 + a2 + '</div>' 				
				div.innerHTML = bar;
				var Obj = document.getElementById('a' + p);				
				Obj.style.color = "#FFA07A"; 
				if(p == 1){
					rn = 100;
					trid = "";
					trs = "";
					var aa = '<span style="padding-left:20px;"><input id="Radio1" type="radio" value="Radio1"/>自定义文件</span>'
					var bb = '<span style="padding-left:10px;"><input id="Radio2" type="radio" value="Radio2"/>通达信板块</span>'
					div.innerHTML += '<div><font size="2" style="padding-left:10px;color:#FFFFF0;">自选股</font>' + aa + bb + '</div>';
					if(w == 1){	
						$("#Radio1").prop('checked', true);
					}else if (w == 2){
						$("#Radio2").prop('checked', true);
					}
					zxg();
				}else if(p == 2){
					trid = "";
					trs = "";
					rn = 2;
					kpl(1);				
				}
			}
						
			function zxg() {
				bmc = "自选股";
				var Radio = $("input[type=radio]:checked").val();
				var dms = "";	
				if(Radio == "Radio1"){	
					var text = load("自选股.txt");					
					var aa = text.split("\r\n")
					for (i = 0; i < aa.length; i++){
						var dm = aa[i];
						if(dm.substr(0,1)=="6"){
							dms += "sh" + dm + ",";
						}else{
							dms += "sz" + dm + ",";
						}					
					}				
				}else if (Radio == "Radio2"){
					//var text = load("../T0002/blocknew/ZXG.blk");
					var text = load("file:///E:/zd_zyb(7.641)/T0002/blocknew/ZXG.blk");				
					var aa = text.split("\r\n")
					for (i = 0; i < aa.length; i++){					
						var dm = aa[i];
						if(dm != ""){
							if(dm.substr(0,1) == "1"){
								dms += "sh" + dm.substr(1,6) + ",";
								dms = dms.replace('999999','000001');
							}else{
								dms += "sz" + dm.substr(1,6) + ",";
							}	
						}					
					}
				}
				
				var url = "http://qt.gtimg.cn/q=" + dms;
				var res = [];
				$.ajax({
					type: "get",
					url: url,
					dataType: "text",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))						
						//document.write(data);							
						//var ss = data.replace(/(")|(=)/g,'').split(';');
						var ss = data.replace(/(\n)|(v_)|(="51)|(="1)/g,'').split(';');
						for (var i = 0; i < ss.length - 1; i++){
							var aa = ss[i].split("~")							
							//res.push({"code":aa[0],"name":aa[1],"xj":aa[3],"zf":aa[32],"hsl":aa[38]});
							res.push({"code":aa[0],"name":aa[1],"zf":aa[32]});
						}											
					}
				});
				function up(a,b){
					return b.zf-a.zf
				}
				res.sort(up);				
				if(rn == 100){
					rn = 2;
					fls = false;
				}
				table(res);
			}
			
			var fx = 1;
			var order = 1;
			var bmc = "";			
			function kpl(p) {
				if(fx != p){
					trid = "";
					trs = "";
					trid1 = "";
				}
				fx = p;
				
				var url = "https://apphq.longhuvip.com/w1/api/index.php?Order=1&a=RealRankingInfo&st=30&apiv=w21&Type=1&c=ZhiShuRanking&PhoneOSNew=1&ZSType=7&"; 				
				var res = [];
				$.ajax({
					type: "get",
					url: url,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))						
						//document.write(JSON.stringify(data));
						var j = 0;
						for (var i = 0; i < data.list.length; i++){
							var mc = data.list[i][1];
							if(mc.indexOf('ST') == -1){
								res.push({"code":data.list[i][0],"name":mc,"qd":data.list[i][2],"zf":keepTwoDecimal(data.list[i][3])});
								j++;
							}								
							if(j == 5){
							 break;
							}
						}											
					}
				});
				
				var div = document.getElementById('towrite1');
				var s = "<span><a href='javascript:void(0)' style='padding-left:20px;color:#FFFF00;' onclick='getbkfs(1);'>板块走势图</a></span>";				
				var bklb = '<span style="margin:-5px 0px -3px 15px;color:#00FFFF;">板块</span>' + s + '<div id ="kplbk" style="margin-left:-10px;"></div>';
				

				if(!document.getElementById('kplbk')){
					div.innerHTML += bklb;
				}
				table1(res);
				
				
				var bkdm = res[p - 1]["code"];
				var bkmc = res[p - 1]["name"];
				bmc = bkmc;
				
				var tr = document.getElementById(bkdm + "##" + bkmc);
				tr.style.backgroundColor = "#483D8B";
				
				//$("#bkdm").text(bkdm);
				//$("#bkmc").text(bkmc);
				
				var url1 = "https://apphq.longhuvip.com/w1/api/index.php?Order=" + order + "&st=30&a=ZhiShuStockList_W8&c=ZhiShuRanking&old=0&apiv=w21&Type=6&PlateID=" + bkdm; 												
				var res1 = [];
				$.ajax({
					type: "get",
					url: url1,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,					
					success: function(data) {
						//alert(JSON.stringify(data))					
						//document.write(JSON.stringify(data));							
						
						for (var i = 0; i < data.list.length; i++){
							var dm = data.list[i][0];
							if(dm.substr(0,1)=="6"){
								dm = "sh" + dm;
							}else{
								dm = "sz" + dm;
							}
							res1.push({"code":dm,"name":data.list[i][1],"zf":data.list[i][6]});							
						}											
					}
				});	
				
				var bkgg = '<p id ="bkgg" style="margin:-5px 0px -3px 15px;color:#00FFFF;">个股</p>';
				if(!document.getElementById('bkgg')){
					div.innerHTML += bkgg;
				}
				table(res1);
				changeCss1(objt,trid,"gg");
			}
			
			function table(res) {
				var div = document.getElementById("towrite1");
				var oTable = document.getElementById('gg');
				if(oTable){
					div.removeChild(oTable);  //清除table
				}
				
				var json = res;					
				//创建table					
				var table=document.createElement("table");										
				var thead=document.createElement("thead");
				table.appendChild(thead);					
				var tr=document.createElement("tr");
				thead.appendChild(tr);					
				
				var m = 0;
				var n = 0;
				var b = 0;
				//var gl = "涨幅";  //高亮
				for(var key in json[0]){  //表头
					key = key.replace('code','代码').replace('name','名称').replace('zf','涨幅%').replace('xj','现价').replace('hsl','换手率%');
					var th=document.createElement("th");						
					th.innerHTML=key;						
					tr.appendChild(th);					
					<!-- if(sx == 1 && rn == 100 && m == 2){ -->
						<!-- th.style.color = "#FFFF80";	 -->
					<!-- } -->
					if(m == rn){
						th.style.color = "#FFFF80";						
					}
					m++;
				}
									
				var tbody=document.createElement("tbody");					
				table.appendChild(tbody);
				
				//遍历json
				for(var i = 0; i < json.length; i++){					
					var tr=document.createElement("tr");						
					var p = 1;
					var dm = "";
					var mc = "";
					for(var key in json[i]){ //行元素遍历						
						var td=document.createElement("td");							
						
						var rc = json[i][key];
						//alert(rc)
						if(p == 1){  //代码列
							dm = rc;
							tr.id = "trids";							
						}else if(p == 2){
							mc = rc;
							tr.id = dm + "##" + mc;
						}
						
						//联动通达信
						//td.innerHTML = "<a href=http://www.treeid/code_" + dm + " id='" + p + "' onclick='getfs(\"" + dm + "\",1);changeCss(this,\"" + tr.id + "\",\"gg\")'>" + rc.replace(/(sh)|(sz)/g,"") + "</a>";
						
						//不联动
						td.innerHTML = "<a href='javascript:void(0)' id='" + p + "' onclick='getfs(\"" + dm + "\",1);changeCss(this,\"" + tr.id + "\",\"gg\")'>" + rc.toString().replace(/(sh)|(sz)/g,"") + "</a>";
						//td.innerHTML.replace("trids",tr.id);
						
						<!-- if(sx == 1 && rn == 100 && p == 3){ -->
							<!-- if(parseFloat(td.getElementsByTagName("a")[0].innerText) >= 0){ -->
								<!-- td.getElementsByTagName("a")[0].style.color = "#FF6633"; -->
							<!-- }else{ -->
								<!-- td.getElementsByTagName("a")[0].style.color = "#00FF00";								 -->
							<!-- } -->
						<!-- } -->
						
						if(p == rn + 1){
							if(p == 3){
								if(parseFloat(td.getElementsByTagName("a")[0].innerText) >= 0){
									td.getElementsByTagName("a")[0].style.color = "#FF6633";
								}else{
									td.getElementsByTagName("a")[0].style.color = "#00FF00";								
								}
							}else{
								td.getElementsByTagName("a")[0].style.color = "#FF6633";
							}
						}
						tr.innerHTML = tr.innerHTML.replace(/trids/g,tr.id);														
						tr.appendChild(td);							
						p++;
					}														
					tbody.appendChild(tr);																
				}					
				
				div.appendChild(table);
				table.id = "gg";
				table.style.marginTop = "5px";
				if(sx == 2){
					table.style.border= "2px solid #C0C0C0";
				}
				hover();
				makeSortable(table);
			}
			
			function table1(res) {
				var div = document.getElementById("kplbk");				
				var oTable = document.getElementById('bk');
				if(oTable){
					div.removeChild(oTable);  //清除table
				}
				
				var json = res;					
				//创建table					
				var table=document.createElement("table");										
				var thead=document.createElement("thead");
				table.appendChild(thead);					
				var tr=document.createElement("tr");
				thead.appendChild(tr);					
				
				
				for(var key in json[0]){  //表头
					key = key.replace('code','代码').replace('name','名称').replace('zf','涨幅%').replace('qd','强度');
					var th=document.createElement("th");						
					th.innerHTML=key;						
					tr.appendChild(th);					
				}
									
				var tbody=document.createElement("tbody");					
				table.appendChild(tbody);
				
				//遍历json
				for(var i = 0; i < json.length; i++){					
					var tr=document.createElement("tr");						
					var p = 1;
					var dm = "";
					var mc = "";
					for(var key in json[i]){ //行元素遍历						
						var td=document.createElement("td");							
						
						var rc = json[i][key];
						//alert(rc)
						if(p == 1){  //代码列
							dm = rc;
							tr.id = "bkid";							
						}else if(p == 2){
							mc = rc;
							tr.id = dm + "##" + mc;
						}
						
						td.innerHTML = "<a href='javascript:void(0)' id='" + p + "' onclick='kpl(" + parseInt(i + 1) + ");changeCssbk(this,\"" + tr.id + "\",\"bk\")'>" + rc + "</a>";
						tr.innerHTML = tr.innerHTML.replace(/bkid/g,tr.id);
						tr.appendChild(td);							
						p++;
					}					
					tbody.appendChild(tr);					
				}					
				
				div.appendChild(table);
				table.id = "bk";
				table.style.marginTop = "5px";
				table.style.border= "2px solid #FFF5EE";
				hover1();
			}
			
			var trid = "";
			var trs = "";
			function changeCss(obj,hid,id){	
				trs = "";
				objt = obj;
				var tlist = document.getElementById(id).getElementsByTagName("tr");					
				var j = 0;
				for(var i = 0; i < tlist.length; i++){
					if(tlist[i].id == hid || ( j > 0 && j < 6)){
						j++;
						tlist[i].style.backgroundColor = "#494949";
						trs += tlist[i].id;
					}else{					
						tlist[i].style.backgroundColor = bkcolor; 
					}					
				}
				trid = hid;
				var tr = document.getElementById(hid);
				tr.style.backgroundColor = "#483D8B";
			}
			
			var objt = "";
			function changeCss1(obj,hid,id){
				var tlist = document.getElementById(id).getElementsByTagName("tr");					
				for(var i = 0; i < tlist.length; i++){				
					if(trs.indexOf(tlist[i].id) > -1 && tlist[i].id != ""){
						if(tlist[i].id == hid ){						
							tlist[i].style.backgroundColor = "#483D8B";
						}else{
							tlist[i].style.backgroundColor = "#494949";
						}
					}else{					
						tlist[i].style.backgroundColor = bkcolor; 
					}					
				}				
			}
			
			var trid1 = "";
			var objt1 = "";
			function changeCssbk(obj,hid,id){	//kplbk
					objt1 = obj;
					var tlist = document.getElementById(id).getElementsByTagName("tr");										
					for(var i = 0; i < tlist.length; i++){
						tlist[i].style.backgroundColor = bkcolor;			
					}
					trid1 = hid;
					var tr = document.getElementById(hid);
					tr.style.backgroundColor = "#483D8B";
			}
			
			function hover(){  //鼠标经过				
				var rows = document.getElementById("gg").getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){						
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}
					rows[i].onmouseout=function(){
						if(this.id != ""){  //过滤表头
							if(this.id != trid){  //过滤选中行
								if(trs.indexOf(this.id)>-1){
									this.style.background = "#494949";
								}else{
									this.style.background = bkcolor;
								}
							}else{
								this.style.background ="#483D8B";
							}
						}						
					}					
				}
			}			
			
			function hover1(){  //鼠标经过				
				var rows = document.getElementById("bk").getElementsByTagName('tr');
				for(var i=0;i<rows.length;i++){
					rows[i].onmouseover=function(){						
						if(this.id != ""){  //过滤表头
							this.style.background="#800000";
						}
					}
					rows[i].onmouseout=function(){
						if(this.id != ""){  //过滤表头
							if(this.id != trid1){  //过滤选中行
								this.style.background = bkcolor;
							}else{
								this.style.background ="#483D8B";
							}
						}						
					}					
				}
			}			
			
			var rn = 100;
			var sfx = 0;  //自动刷新开关
			var fls = false;  //排序方向
			function makeSortable(table) {
				var headers=table.getElementsByTagName("th");
				for(var i=0;i<headers.length;i++){				
					(function(n){
						var flag=true;
							
						headers[n].onclick=function(){
							rn = n;
							
							if(n == 2 && sx > 1){
								if(order == 1){
									order = 0;									
								}else{
									order = 1;									
								}
								kpl(fx);
							}
							//alert(n)
							showCol(n);		//高亮
							changeCss1(objt,trid,"gg");
							
							var tbody=table.tBodies[0];
							var rows=tbody.getElementsByTagName("tr");
							rows=Array.prototype.slice.call(rows,0);

							//基于第n个<td>元素的值对行排序
							rows.sort(function(row1,row2){
								headtxt = headers[n].textContent;								
								var cell1=row1.getElementsByTagName("td")[n];//获得第n个单元格
								var cell2=row2.getElementsByTagName("td")[n];																
								var val1=cell1.textContent||cell1.innerText;//获得文本内容
								var val2=cell2.textContent||cell2.innerText;
								if(headtxt.indexOf("名称") != -1){
									val1 = val1;
									val2 = val2;
								}else{									
									val1 = parseFloat(val1)									
									val2 = parseFloat(val2);									
								}
								if(val1<val2){
									return 1;
								}else if(val1>val2){
									return -1;
								}else{
									return 0;
								}
							});
							
							if(sfx == 1){   //自动刷新时，保持排序方向
								flag = fls;								
							}
							fls = flag;							
							sfx = 0;
							
							if(flag){
								rows.reverse();
							}
							
							for(var i=0;i<rows.length;i++){
								tbody.appendChild(rows[i]);
							}

							flag=!flag;
						}
					}(i));
				}
			}
			
			function showCol(iCol){			
				//var oTable = document.getElementsByTagName('table')[0];
				var oTable = document.getElementById("gg");
				for (i=0;i < oTable.rows.length; i++){										
					for (j=0;j < oTable.rows[0].cells.length; j++){
						oTable.rows[i].cells[j].style.color = "#E5E5E5";								
					}
					oTable.rows[i].cells[iCol].style.color = "#FFFF80";					
				}

				otagsA = oTable.getElementsByTagName("a");  //a变色
				for (i = 0; i < otagsA.length; i++) {
					otagsA[i].style.color = "#E5E5E5";					
					if(otagsA[i].id == iCol + 1){					
						otagsA[i].style.color = "#FF6633";
						
						if(otagsA[i].id == rn + 1 && parseFloat(otagsA[i].innerText) < 0){
							otagsA[i].style.color = "#00FF00";
						}
					}
				}								
			}
			
			function getfs(dm,p){
				var div = document.getElementById('bar2');
				var fs = "<span><a href='javascript:void(0)' id='g1' style='padding-left:20px;' onclick='getfs(\"" + dm + "\",1);'>分时</a></span>";
				var kx = "<span><a href='javascript:void(0)' id='g2' onclick='getfs(\"" + dm + "\",2);'>K线</a></span>";
				div.innerHTML = '<font size="2" style="padding-left:10px;color:#FFFFF0;">' + bmc + '</font>' + fs + kx;
				var aObj = document.getElementById("g" + p);
				aObj.style.color = "#FFA500";
				//div.innerHTML = '<font size="2" style="padding-left:10px;color:#FFFFF0;">' + bmc + '</font>';
				
				for (var i = 1; i < 7; i++) {					
					destroyIframe('mapIframe'+ i)
				}				
				var j = 0;
				var tlist = document.getElementById("gg").getElementsByTagName("tr");					
				for(var i = 0; i < tlist.length; i++){					
					var ss = tlist[i].id.split('##'); 
					var gpdm = ss[0];
					var gpmc = ss[1];
					//alert(gpdm)
					if(gpdm == dm || j > 0){
						j++;
						var url = "东财分时图(引用).html##" + gpdm + "##" + gpmc;				
						if(p == 2){
							url = "东财K线图.html##" + gpdm.replace(/(sh)|(sz)/g,"") + "##" + gpmc + "##0";	
						}
						var iframe = document.getElementById('mapIframe'+ j);
						iframe.src = url;
					}
					if(j == 6){
						break;
					}
				}				
			}
			
			 function getbkfs(p){
				var div = document.getElementById('bar2');
				var fs = "<span><a href='javascript:void(0)' id='b1' style='padding-left:20px;' onclick='getbkfs(1);'>分时</a></span>";
				var kx = "<span><a href='javascript:void(0)' id='b2' onclick='getbkfs(2);'>K线</a></span>";
				div.innerHTML = '<font size="2" style="padding-left:10px;color:#FFFFF0;">板块走势</font>' + fs + kx;
				var aObj = document.getElementById("b" + p);
				aObj.style.color = "#FFA500";
					
				for (var i = 1; i < 7; i++) {					
					destroyIframe('mapIframe'+ i)
				}				
				var j = 0;
				var tlist = document.getElementById("bk").getElementsByTagName("tr");					
				for(var i = 1; i < tlist.length; i++){
					j++;
					var ss = tlist[i].id.split('##'); 
					var bkdm = ss[0];
					var bkmc = ss[1];
					var url = "kpl-分时图.html##" + bkdm + "##" + bkmc + "##0";				
					if(p == 2){
						url = "kpl-K线图.html##" + bkdm + "##" + bkmc + "##0";	
					}
					var iframe = document.getElementById('mapIframe'+ j);
					iframe.src = url;					
					if(j == 6){
						break;
					}
				}				
			}
			
			//销毁iframe，释放iframe所占用的内存。 			
			function destroyIframe(iframeID){ 
				var iframe = document.getElementById(iframeID);
				
				//把iframe指向空白页面，这样可以释放大部分内存。 
				iframe.src = 'about:blank'; 
				
				try{ 
					iframe.contentWindow.document.write(''); 
					iframe.contentWindow.document.clear(); 
				}catch(e){} 
				
				//把iframe从页面移除 
				//iframe.parentNode.removeChild(iframe); 
			}

		</script>		
	</body>
</html>